<me:UIWDECK x:Class="WPFExcelReport.TPRWD02"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL" 
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT"  
                    xmlns:WH="clr-namespace:WPFExcelReport;assembly=TLAGPL"   
                    xmlns:WS="clr-namespace:WPFExcelReport;assembly=TWASTAMM"  
                    xmlns:WF="clr-namespace:WPFExcelReport;assembly=TWAFARBEN"   
                    xmlns:LS="clr-namespace:WPFExcelReport;assembly=TLIEFDAT"   
                    xmlns:VF="clr-namespace:WPFExcelReport;assembly=TVAFARBEN"  
                      xmlns:AP="clr-namespace:WPFExcelReport;assembly=TAPKOPF"  
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls" 
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                    x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:UIWDECK.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>
        <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:NOTBoolToVisibilityConverter x:Key="nbv"/>
        <ucd:NOTConverter  x:Key="not"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
        <ucd:PNumConverter x:Key="pnum"/>
    </me:UIWDECK.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"></ColumnDefinition>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Row="0"   Grid.Column="0" >
            <WrapPanel >
                <WrapPanel>
                    <Button  Click="AppendBundlesCommand" Height="20" Margin="5,0,0,0" Width="20" ToolTip="{Binding Source={Localization:Translate Word=加入合并}}" 
                                 IsEnabled="{Binding IsABKGenerated,ElementName=TV,Converter={StaticResource not}}">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                        </Button.Background>
                    </Button>
                    <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=加入合并}}" 
                                     IsEnabled="{Binding IsABKGenerated,ElementName=TV,Converter={StaticResource not}}"/>
                    <Button  Click="RemoveBundlesCommand" Height="20" Margin="5,0,0,0" Width="20" ToolTip="{Binding Source={Localization:Translate Word=删除合并}}">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Delete.png" />
                        </Button.Background>
                    </Button>
                    <Button  Click="BundlesCommand" Height="20" Margin="5,0,0,0" Width="20" ToolTip="{Binding Source={Localization:Translate Word=合并生产}}">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/skin_studio.png" />
                        </Button.Background>
                    </Button>
                    <TextBlock Text="{Binding BNDABP,ElementName=TV}" Foreground="Red" Width="Auto" Visibility="{Binding IsOnBundleMode,ElementName=TV,Converter={StaticResource bv}}"/>
                    <TextBlock Text="{Binding QTY,ElementName=TV}" Foreground="Red" Width="Auto" Visibility="{Binding IsOnBundleMode,ElementName=TV,Converter={StaticResource bv}}"/>
                </WrapPanel>
                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=品种:}}"></TextBlock>
                    <ex:AutoTrimTextBox MaxLength="24" Grid.Column="1" CharacterCasing="Upper" Text="{Binding ART,ElementName=TV}" Width="180" />
                </Grid>
                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=色号:}}"></TextBlock>
                    <ex:AutoTrimTextBox MaxLength="10" Grid.Column="1" CharacterCasing="Upper" Text="{Binding FARBE,ElementName=TV}" Width="80" />
                </Grid>
                <WrapPanel>
                    <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=类型:}}"></TextBlock>
                    <ex:TXT72 MaxLength="1" Grid.Column="0" Text="{Binding AUFART,ElementName=TV}" Width="30" />
                    <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=单号:}}"></TextBlock>
                    <ex:TXT72 MaxLength="2" Grid.Column="1" Text="{Binding KRS,ElementName=TV}" Width="30" />
                    <ex:TXT72 MaxLength="6" Grid.Column="2" Text="{Binding LFD,ElementName=TV}" Width="80" />
                    <ex:TXT72 MaxLength="3" Grid.Column="3"  Text="{Binding POS,ElementName=TV}" Width="40" />
                </WrapPanel>
                <Button  Click="QueryCommand" Height="20" Margin="5,0,0,0" Width="24" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                    </Button.Background>
                </Button>
                <CheckBox Content="{Binding Source={Localization:Translate Word=已付款}}" IsChecked="{Binding IsVKPaid,ElementName=TV}"  ></CheckBox>
                <CheckBox Content="{Binding Source={Localization:Translate Word=含已计划}}" IsChecked="{Binding IsShowAll,ElementName=TV}"></CheckBox>

            </WrapPanel>  
            <WrapPanel>
                <TextBlock Text="{Binding INFO,ElementName=TV}" Foreground="Green"/>
                <TextBlock Foreground="Red" Text="首先判断此单是否已经创建了生产单，提示删除,进入何并生产模式,产生生产单号码,下一个使用相同单号,创建完成后，解除何并模式}" 
                                   Visibility="{Binding IsOnBundleMode,ElementName=TV,Converter={StaticResource bv}}"/>
            </WrapPanel>
            <WrapPanel> 
                <WrapPanel >
                    <ex:TXT72 Text="{Binding KRS,ElementName=TV}" PRE="  " CharacterCasing="Upper" MaxLength="2"  Width="40"/>
                    <WF:TSWF ART="{Binding ART,ElementName=TV}" 
                         VAR="{Binding VAR,ElementName=TV}" 
                         FARBE="{Binding FARBE,ElementName=TV}" 
                         FINISH="{Binding FINISH,ElementName=TV}" 
                         DESS="{Binding DESS,ElementName=TV}" 
                         COLORIT="{Binding COLORIT,ElementName=TV}" 
                         IsEdit="True"/>
                    <TextBlock Text="{Binding Source={Localization:Translate Word=流程:}}"/>
                    <AP:TSAP02 ARTST="F"
                      IsEdit="True"
                      KEY ="{Binding FLOW,ElementName=TV}"
                      WH="{Binding WH,ElementName=TV}" />
                    <Button Grid.Column="1" Height="20"  Width="Auto" Margin="10,0,0,0"  Click="ManualCreateCommand" Content="{Binding Source={Localization:Translate Word=手工创建}}"/> 
                </WrapPanel>
            </WrapPanel>
        </StackPanel>
        <DataGrid   Grid.Row="1"   Grid.Column="0"   
                   VerticalAlignment="Top"  
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   IsReadOnly="True"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"   
                   ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}" 
                   IsSynchronizedWithCurrentItem="True" 
                   x:Name="dlgMaster"  
                   RowDetailsVisibilityMode="Visible"  
                    >
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Path=VKPBSTSTA}" Header="{Binding Source={Localization:Translate Word=预付款}}"  Width="Auto" Visibility="Collapsed" />
                <DataGridTextColumn Binding="{Binding Path=VRPERLKZ}" Header="{Binding Source={Localization:Translate Word=发票款}}"  Width="Auto" Visibility="Collapsed" />
                <DataGridTextColumn Binding="{Binding Path=VRPGESWERT,Converter={StaticResource ResourceKey=d100}}" Header="{Binding Source={Localization:Translate Word=金额}}"  Width="Auto" Visibility="Collapsed" />
                <DataGridTextColumn Binding="{Binding Path=VKPKUNDNR,Converter={StaticResource ResourceKey=pnum}}" Header="{Binding Source={Localization:Translate Word=客户}}"  Width="Auto" Visibility="Collapsed" />
                <DataGridTextColumn Binding="{Binding Path=KDKUNDNA,Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=客户}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VKPBSTSTA}" Header="{Binding Source={Localization:Translate Word=行付款锁定}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VKPGESSTA}" Header=""  Width="Auto" Visibility="Collapsed" />
                <DataGridTextColumn Binding="{Binding Path=VKPARTSTA}" Header=""  Width="Auto" Visibility="Collapsed"/>
                <DataGridTextColumn Binding="{Binding Path=VKPPRSTA}" Header=""  Width="Auto" Visibility="Collapsed"/>
                <DataGridTextColumn Binding="{Binding Path=VKPTERMSTA}" Header=""  Width="Auto" Visibility="Collapsed" />
                <DataGridTextColumn Binding="{Binding Path=WDAUFKRS}" Header=""  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=WDAUFLFD,Converter={StaticResource ResourceKey=pnum}}" Header="{Binding Source={Localization:Translate Word=需求单}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=WDAUFPOS,Converter={StaticResource ResourceKey=pnum}}" Header=""  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=WDART}" Header="{Binding Source={Localization:Translate Word=品种}}"  Width="120" />
                <DataGridTextColumn Binding="{Binding Path=WDFARBE,Converter={StaticResource ResourceKey=gb2312}}" Header="{Binding Source={Localization:Translate Word=色号}}"  Width="40" />
                <DataGridTextColumn Binding="{Binding Path=WDBESCHICH}" Header="{Binding Source={Localization:Translate Word=整理}}"  Width="40" />
                <DataGridTextColumn Binding="{Binding Path=WDDESS}" Header="{Binding Source={Localization:Translate Word=印花}}"  Width="40" />
                <DataGridTextColumn Binding="{Binding Path=WDCOLORIT}" Width="40" />
                <DataGridTextColumn Binding="{Binding Path=WDBEDARF,Converter={StaticResource ResourceKey=d100}}" Header="{Binding Source={Localization:Translate Word=需求}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=WDZUGET,Converter={StaticResource ResourceKey=d100}}" Header="{Binding Source={Localization:Translate Word=留位}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=WDRESERV,Converter={StaticResource ResourceKey=d100}}" Header="{Binding Source={Localization:Translate Word=预留}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=WDDAT,Converter={StaticResource ResourceKey=gb2312}}" Header="{Binding Source={Localization:Translate Word=日期}}"  Width="Auto" />
            </DataGrid.Columns>
        </DataGrid  >
    </Grid>
</me:UIWDECK>
